'use strict'
$(function(){
    $.ajax({
        type:'get',
        url:"http://localhost:8088/roles",
        success:function(res){
            res.forEach(item => {
                let html=` 
                    <tr id="${item.id}">
                        <td>${item.id}</td>
                        <td>${item.name}</td>
                        <td>${item.emali}</td>
                        <td><input type="button" name="put" value="编辑" onclick="btnput()">
                        <input type="button" name="del" value="删除" onclick="btndel(${item.id})">
                        </td>
                    </tr>`
            let js = $('#js')
            js.append(html)
            });
        }
    })
})

function btnput(){
    location.href='item.html';
}

function btndel(id){
 if(confirm('你确定要删除吗？')){
    $.ajax({
        type:'delete',
        url:"http://localhost:8088/roles/"+id,
        success:function(res){
            $('#')
        }
    })
 }
}

function btnAll(){

}

function btnAdd(){
    location.href='item.html';
}

function tj(){

}

function qx(){
    if(confirm("你是否取消")){
        location.href = 'index.html'
    }
}